from services.vector_store import VectorStoreService
from config.settings import settings


def get_retriever():
    """获取金融专用检索器"""
    vector_store = VectorStoreService().load_vector_store()

    # 配置检索参数
    return vector_store.as_retriever(
        search_type="similarity",
        search_kwargs={
            "k": 5,  # 返回前5个最相关片段
            "filter": {"source": "financial"}  # 元数据过滤
        }
    )